package com.mybatisx.mybatisplus.controller;

import com.mybatisx.mybatisplus.entity.User;
import com.mybatisx.mybatisplus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lyh
 * @since 2021-06-22
 */
@RestController
@RequestMapping("/mybatisplus/user")
public class UserController {

    @Autowired
    private UserService userService;
    @RequestMapping("/getUserById/{id}")
    public User getUserById(@PathVariable("id") String id){
       return    userService.findUserById(id);
    }
    @RequestMapping("/saveUser")
    public int save(@RequestBody User user){
       return    userService.saveUser(user);
    }
    @RequestMapping("/delete/{id}")
    public int delete(@PathVariable("id")String id){
       return    userService.delete(id);
    }



}

